package Games;

import java.awt.Canvas;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;

public class Paddle extends Image {

	public Paddle (Point center, Dimension size, String imageName)
	   {
	       super(center, size, new Point(0, 0), imageName);
	   }
	 public void update (Canvas canvas)
	   {
	       Dimension bounds = canvas.getSize();
	       // move based on input
	       String key = ((Object) canvas).getLastKeyPressed();
	       if (key.equals("A") && getLeft() > 0)
	       {
	           getCenter().x -= 10;
	       }
	       else if (key.equals("D") && getRight() < bounds.width)
	       {
	           getCenter().x += 10;
	       }
	   }
	@Override
	public Graphics getGraphics() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public int getHeight(ImageObserver arg0) {
		// TODO Auto-generated method stub
		return 0;
	}
	@Override
	public Object getProperty(String arg0, ImageObserver arg1) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public ImageProducer getSource() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public int getWidth(ImageObserver arg0) {
		// TODO Auto-generated method stub
		return 0;
	}
}
